<template>
	<view>

		<u--form labelPosition='top'  labelWidth='700rpx' :model="formState" name="basic" layout="horizontal"
			:labelCol="{span:7}" :wrapperCol="{span: 13, offset: 0}">
			<u-collapse :value="['1','2']" ref='coll'>
				<u-collapse-item name="1" title="整改结果" icon="https://cdn.uviewui.com/uview/example/cell.png">
					<u-cell-group>
						<u-cell title="结果备注" :label="formState.Remark"></u-cell>
					</u-cell-group>
					<!-- 	<u-form-item label="工作任务" name="Task" :required="true">
						<u--input v-model="formState.Task" />
					</u-form-item>
					<u-form-item label="关键工序" :required="true" name="KeyStep">
						<u--input v-model="formState.KeyStep" />
					</u-form-item>
					<u-form-item label="测试结果" :required="true" name="TestResult"
						:rules="[{ required: true, message: '请输入值' }]">
						<u--input allow-half v-model="formState.TestResult" :min="0" />
					</u-form-item> -->
				</u-collapse-item>
			
				<u-collapse-item name="2" title="整改后照片" icon="https://cdn.uviewui.com/uview/example/image.png">
					<u-album :urls="imagesurls"></u-album>
				</u-collapse-item>
			</u-collapse>
		</u--form>
		<!-- <u-button type="primary" text="保存" @click="save"></u-button> -->
		<u-notify ref="uNotify"></u-notify>
	</view>
</template>

<script>
	import {
		baseUrl
	} from '@/common/config.js'
	import {
		mapGetters
	} from 'vuex'
	import {
		getflowrecordbyid,
		addbuildsafe,
		getfilebyoutid
	} from '@/common/api.js'
	export default {
		data() {
			return {
				coll:[],
				CheckJsonArr: [],
				formState: {}, 
				fileList1: [],
				buildid: null,
				id: null,
				imagesurls: [],
				notifyData: {
					message: '保存成功',
					type: 'success',
					color: '#ffffff',
					bgColor: '',
					fontSize: 15,
					duration: 3000,
					safeAreaInsetTop: false
				},
			}
		},
		onLoad(option) {
			this.buildid = option.buildid
			if (option.id)
			this.id = option.id
				this.getdate(option.id)
				

		},
		onShow()
		{
			getfilebyoutid(this.id).then(res=>{
				for(var i =0;i<res.length;i++)
				{
					this.imagesurls=[]
					if(res[i].MyType=='整改后照片')
					{
						this.imagesurls.push(`${baseUrl}/SysFile/download?id=${res[i].Id}`)
					}
				}
				console.log(this.imagesurls)
				this.$nextTick(() => {
				    this.$refs.coll.init()
				});
			})
		},

		methods: {

			getdate(id) {
				getflowrecordbyid(id).then(res => {
					this.formState = res
	                // this.$nextTick(() => {
	                //     this.$refs.coll.init()
	                // });
					setTimeout(()=>{
						this.$refs.coll.init()
					},500)
				})
			},

		}
	}
</script>

<style>
  
</style>
